package com.oromwin.repos.common;

import org.apache.commons.logging.Log;

public class ReposException extends Exception {
    private static final long serialVersionUID = 6231323640230936837L;

    public ReposException(Exception e) {
        super(e);
    }

    public ReposException(String msg) {
        super(msg);
    }
    
    public static ReposException create(Log log, Exception e) {
        return create(log, e, "");
    }

    public static ReposException create(Log log, String message) {
        ReposException e = new ReposException(message);
        Logger.errorWithThrowable(log, e, message);
        return e;
    }

    public static ReposException create(Log log, Exception e, String message) {
        Logger.errorWithThrowable(log, e, message);
        if (e instanceof ReposException) {
            return (ReposException) e;
        }
        return new ReposException(e);
    }
}
